-- FETCH_MACHINE_INSTITURE_GOODS

-- 抽取机械研究所商品
return function()
    local ret = {};

    -- 活动副本对应手册
    local manuals = {[20001] = 1201, [20002] = 1202, [20003] = 1203};

    -- 根据当前地牢获取手册
    local dungeonId = DungeonM.getDungeonId();
    local goodsId = manuals[dungeonId];

    if goodsId and DungeonShopM.getGoodsBuyTime(goodsId) <= 0 then
        -- 没有购买过手册允许出现
        table.insert(ret, { ["goodsId"] = goodsId, });
    end

    -- 机械类道具
    local machinePropertys = {1204, 1205, 1206, 1207};
    -- 随机抽两个
    for i = 1, 2 do
        local rand = DungeonM.getRandSeed("FETCH_MACHINE_INSTITURE_GOODS");
        local index = rand % #machinePropertys + 1; -- 注意：客户端的下标比服务器大1
        goodsId = machinePropertys[index];
        table.insert(ret, { ["goodsId"] = goodsId, });
    end

    -- 能量类道具
    local energyItems = {1208, 1209};
    for i = 1, 3 do
        local rand = DungeonM.getRandSeed("FETCH_MACHINE_INSTITURE_GOODS");
        local index = rand % #energyItems + 1; -- 注意：客户端的下标比服务器大1
        goodsId = energyItems[index];
        table.insert(ret, { ["goodsId"] = goodsId, });
    end

    return ret;
end